In advanced technology nodes of semiconductor industry, metal and high k dielectric material are used to form a metal gate stack of a field-effect transistor (FET). When forming the metal gate stack, one or more metal layers are patterned including deposition and etching. During the metal etch, the etch processing window is not enough and the photoresist (resist) may experience a peeling issue at the metal etch step. Particularly, the usual dry etch process is challenging since the material to be etched is very thin and weak. The exposed metal film cannot be completely etched away and the patterned resist cannot be removed by solvent strip after the dry etch. The substrate also shows damage after the dry etch process. For an usual wet etch process, the wet etch solution can penetrate into the interface between the patterned resist and the metal film and oxidize the metal film underlying the patterned resist, therefore further changing the metal film and degrading the device performance. Moreover, the patterned resist may peel away from the underlying metal film during the wet etch process.